package com.liezh.mediator;

import java.util.HashMap;
import java.util.Map;

public class ChatRoomImpl implements ChatRoom {
    private Map<String, User> usersMap = new HashMap<>();

    public void sendMessage(String msg, String userId) {
        User user = usersMap.get(userId);
        user.receive(msg);
    }

    public void addUser(User user) {
        usersMap.put(user.getId(), user);
    }
}
